package com.kfc.crazy4week.api.service;

import cn.hutool.core.text.UnicodeUtil;
import com.kfc.crazy4week.api.model.dto.WxTranslateDTO;
import com.kfc.crazy4week.api.model.vo.WxTranslateVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class GenerateServiceImpl {

    public WxTranslateVO wxTranslate(WxTranslateDTO wxTranslateDTO) {
        //获取前言
        String s1 = wxTranslateDTO.getS1();
        //获取秘语
        String s2 = wxTranslateDTO.getS2();

        String unicodeEncode = UnicodeUtil.toUnicode(s2);

        //char[] chars = s2.toCharArray();

        //String returnStr = "";

        //for (char aChar : chars) {
        //
        //    returnStr += "\\U" + Integer.toString(aChar, 16);
        //
        //}
        //return new StringBuffer(s1).append("微信长按翻译！").append(returnStr).toString();
        //
        //System.out.println("\\");
        //String s = s1 + "微信长按翻译！" + returnStr;
        //System.out.println(s);
        WxTranslateVO wxTranslateVO = new WxTranslateVO();
        wxTranslateVO.setRes(s1 + " 微信长按翻译！" + unicodeEncode);
        return wxTranslateVO;
    }
}
